package com.douqu.game.battle.controller;

import com.douqu.game.battle.entity.BattleMasterAObject;
import com.douqu.game.battle.entity.PlayerBattleTmp;
import com.douqu.game.core.controller.*;
import com.douqu.game.core.entity.battle.SpriteBattleTmp;
import com.douqu.game.core.protobuf.SGCommonProto;
import org.apache.log4j.Logger;

/**
 * Created by bean on 2017/7/25.
 */
public class PVPController extends BattleController {

    Logger logger = Logger.getLogger(PVPController.class);

    public PVPController(String battleId, PlayerController player, SpriteController target, SGCommonProto.E_BATTLE_TYPE battleType,
                         SGCommonProto.Pos leftBottom, SGCommonProto.Pos rightTop)
    {
        super(battleId, player, target, battleType, leftBottom, rightTop);

        logger.debug("player:" + player + " target:" + target);
    }

    @Override
    public void init()
    {
        super.init();

        //队伍2的主将
        BattleMasterAObject masterAObject2 = new BattleMasterAObject(target, createMasterUniqueId + BattleController.TEAM_2);
        masterAObject2.setTeamNo(BattleController.TEAM_2);
        masterAObject2.setPosition(getMiddlePos(BattleController.TEAM_2));

        SpriteBattleTmp pbt2 = new PlayerBattleTmp();
        pbt2.setBattleParent(this);
        pbt2.init(target, masterAObject2, BattleController.TEAM_2);
        target.setAttachment(pbt2);

        playerList.add((PlayerController) target);

        if(!target.isPlayer())
        {
            pbt2.setReady(true);
        }

        pbt2.setTargetBattleTmp(player.getAttachment());
        player.getAttachment().setTargetBattleTmp(pbt2);
    }




    @Override
    public int getStar(SpriteBattleTmp spriteBattleTmp)
    {
        return 0;
    }


}
